From 4cbe07976741b4b98ef34dc9f2151b33698823c4 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 21 Nov 2016 16:21:38 +0000 Subject: [PATCH] Use Graphene init macros for compound literals The Graphene init macros can now be used for compound literals, which means we need to update our mixed uses. --- gtk/gtkcssimage.c | 2 +- gtk/gtkcssimagebuiltin.c | 2 +- gtk/gtkcssshadowvalue.c | 4 ++-- gtk/gtkcsstransformvalue.c | 2 +- gtk/gtkdebugupdates.c | 2 +- gtk/gtkdrawingarea.c | 2 +- gtk/gtkentry.c | 8 ++++---- gtk/gtkflowbox.c | 2 +- gtk/gtklabel.c | 4 ++-- gtk/gtkrenderbackground.c | 2 +- gtk/gtkrenderborder.c | 2 +- gtk/gtkrendericon.c | 10 +++++----- gtk/inspector/rendernodeview.c | 5 ++--- 13 files changed, 23 insertions(+), 24 deletions(-) diff --git a/gtk/gtkcssimage.c b/gtk/gtkcssimage.c index 81ab757a14..8797ec900b 100644 --- a/gtk/gtkcssimage.c +++ b/gtk/gtkcssimage.c @@ -104,7 +104,7 @@ gtk_css_image_real_snapshot (GtkCssImage *image, cairo_t *cr; cr = gtk_snapshot_append_cairo_node (snapshot, - &(graphene_rect_t)GRAPHENE_RECT_INIT (0, 0, width, height), + &GRAPHENE_RECT_INIT (0, 0, width, height), "Fallback<%s>", G_OBJECT_TYPE_NAME (image)); _gtk_css_image_draw (image, cr, width, height); cairo_destroy (cr); diff --git a/gtk/gtkcssimagebuiltin.c b/gtk/gtkcssimagebuiltin.c index 841ae91d26..00a267ca1a 100644 --- a/gtk/gtkcssimagebuiltin.c +++ b/gtk/gtkcssimagebuiltin.c @@ -664,7 +664,7 @@ gtk_css_image_builtin_snapshot (GtkCssImage *image, } cr = gtk_snapshot_append_cairo_node (snapshot, - &(graphene_rect_t)GRAPHENE_RECT_INIT (0, 0, width, height), + &GRAPHENE_RECT_INIT (0, 0, width, height), "BuiltinImage<%d>", (int) image_type); gtk_css_image_builtin_draw (image, cr, width, height, image_type); cairo_destroy (cr); diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c index 3c7aeb93ae..a86dd9ab2d 100644 --- a/gtk/gtkcssshadowvalue.c +++ b/gtk/gtkcssshadowvalue.c @@ -1038,7 +1038,7 @@ gtk_css_shadow_value_snapshot_outset (const GtkCssValue *shadow, gtk_css_shadow_value_get_extents (shadow, &extents); cr = gtk_snapshot_append_cairo_node (snapshot, - &(graphene_rect_t) GRAPHENE_RECT_INIT ( + &GRAPHENE_RECT_INIT ( border_box->box.x - extents.left, border_box->box.y - extents.top, border_box->box.width + extents.left + extents.right, @@ -1062,7 +1062,7 @@ gtk_css_shadow_value_snapshot_inset (const GtkCssValue *shadow, return; cr = gtk_snapshot_append_cairo_node (snapshot, - &(graphene_rect_t) GRAPHENE_RECT_INIT ( + &GRAPHENE_RECT_INIT ( padding_box->box.x, padding_box->box.y, padding_box->box.width, diff --git a/gtk/gtkcsstransformvalue.c b/gtk/gtkcsstransformvalue.c index 4439ba16ea..9c70dbb25e 100644 --- a/gtk/gtkcsstransformvalue.c +++ b/gtk/gtkcsstransformvalue.c @@ -174,7 +174,7 @@ gtk_css_transform_apply (const GtkCssTransform *transform, graphene_matrix_init_from_matrix (matrix, &tmp); break; case GTK_CSS_TRANSFORM_TRANSLATE: - graphene_matrix_translate (matrix, &(graphene_point3d_t)GRAPHENE_POINT3D_INIT( + graphene_matrix_translate (matrix, &GRAPHENE_POINT3D_INIT( _gtk_css_number_value_get (transform->translate.x, 100), _gtk_css_number_value_get (transform->translate.y, 100), _gtk_css_number_value_get (transform->translate.z, 100))); diff --git a/gtk/gtkdebugupdates.c b/gtk/gtkdebugupdates.c index b1d0cf3b52..3219314f58 100644 --- a/gtk/gtkdebugupdates.c +++ b/gtk/gtkdebugupdates.c @@ -290,7 +290,7 @@ gtk_debug_updates_snapshot (GtkWidget *widget, gtk_debug_updates_queue_get_extents (updates, &rect); cr = gtk_snapshot_append_cairo_node (snapshot, - &(graphene_rect_t) GRAPHENE_RECT_INIT(rect.x, rect.y, rect.width, rect.height), + &GRAPHENE_RECT_INIT(rect.x, rect.y, rect.width, rect.height), "Debug Updates"); for (l = g_queue_peek_head_link (updates); l != NULL; l = l->next) diff --git a/gtk/gtkdrawingarea.c b/gtk/gtkdrawingarea.c index 7d4f2ef87d..ecea4c6e9a 100644 --- a/gtk/gtkdrawingarea.c +++ b/gtk/gtkdrawingarea.c @@ -240,7 +240,7 @@ gtk_drawing_area_snapshot (GtkWidget *widget, return; cr = gtk_snapshot_append_cairo_node (snapshot, - &(graphene_rect_t) GRAPHENE_RECT_INIT(0, 0, + &GRAPHENE_RECT_INIT (0, 0, gtk_widget_get_allocated_width (widget), gtk_widget_get_allocated_height (widget)), "DrawingAreaContents"); diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 2a55109542..241d1d7b15 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -3600,10 +3600,10 @@ gtk_entry_render (GtkCssGadget *gadget, /* Draw text and cursor */ cr = gtk_snapshot_append_cairo_node (snapshot, - &(graphene_rect_t) GRAPHENE_RECT_INIT (x + priv->text_x, - y, - priv->text_width, - height), + &GRAPHENE_RECT_INIT (x + priv->text_x, + y, + priv->text_width, + height), "Entry Text"); if (priv->dnd_position != -1) diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c index 1a7c257674..d543d5445c 100644 --- a/gtk/gtkflowbox.c +++ b/gtk/gtkflowbox.c @@ -2592,7 +2592,7 @@ gtk_flow_box_render (GtkCssGadget *gadget, vertical = priv->orientation == GTK_ORIENTATION_VERTICAL; cr = gtk_snapshot_append_cairo_node (snapshot, - &(graphene_rect_t)GRAPHENE_RECT_INIT(x, y, width, height), + &GRAPHENE_RECT_INIT (x, y, width, height), "FlowBox Rubberband"); context = gtk_widget_get_style_context (widget); diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index e9e6a69bf6..42dac23e26 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -4169,7 +4169,7 @@ gtk_label_snapshot (GtkWidget *widget, static void layout_to_window_coords (GtkLabel *label, gint *x, gint *y); -#define GRAPHENE_RECT_FROM_RECT(_r) ((graphene_rect_t) GRAPHENE_RECT_INIT ((_r)->x, (_r)->y, (_r)->width, (_r)->height)) +#define GRAPHENE_RECT_FROM_RECT(_r) (GRAPHENE_RECT_INIT ((_r)->x, (_r)->y, (_r)->width, (_r)->height)) static gboolean gtk_label_render (GtkCssGadget *gadget, @@ -4231,7 +4231,7 @@ gtk_label_render (GtkCssGadget *gadget, range_clip = gdk_pango_layout_get_clip_region (priv->layout, lx, ly, range, 1); cairo_region_get_extents (range_clip, &clip_extents); cr = gtk_snapshot_append_cairo_node (snapshot, - &GRAPHENE_RECT_FROM_RECT(&clip_extents), + &GRAPHENE_RECT_FROM_RECT (&clip_extents), "Selected Text"); gtk_style_context_save_to_node (context, info->selection_node); diff --git a/gtk/gtkrenderbackground.c b/gtk/gtkrenderbackground.c index 11c70b81b2..9388dd81a0 100644 --- a/gtk/gtkrenderbackground.c +++ b/gtk/gtkrenderbackground.c @@ -465,7 +465,7 @@ gtk_css_style_snapshot_background (GtkCssStyle *style, * background. GSK can't do that yet. */ cr = gtk_snapshot_append_cairo_node (snapshot, - &(graphene_rect_t)GRAPHENE_RECT_INIT(0, 0, width, height), + &GRAPHENE_RECT_INIT (0, 0, width, height), "Background"); _gtk_theming_background_paint_color (&bg, cr, bg_color, background_image); diff --git a/gtk/gtkrenderborder.c b/gtk/gtkrenderborder.c index 2672dec035..62b0367c46 100644 --- a/gtk/gtkrenderborder.c +++ b/gtk/gtkrenderborder.c @@ -948,7 +948,7 @@ gtk_css_style_snapshot_outline (GtkCssStyle *style, _gtk_rounded_box_apply_outline_radius_for_style (&border_box, style, GTK_JUNCTION_NONE); cr = gtk_snapshot_append_cairo_node (state, - &(graphene_rect_t) GRAPHENE_RECT_INIT (rect.x, rect.y, rect.width, rect.height), + &GRAPHENE_RECT_INIT (rect.x, rect.y, rect.width, rect.height), "Outline"); render_border (cr, &border_box, border_width, 0, colors, border_style); diff --git a/gtk/gtkrendericon.c b/gtk/gtkrendericon.c index 9578ea4f30..7355ebed26 100644 --- a/gtk/gtkrendericon.c +++ b/gtk/gtkrendericon.c @@ -116,9 +116,9 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style, graphene_matrix_init_from_matrix (&saved_matrix, gtk_snapshot_get_transform (snapshot)); /* XXX: Implement -gtk-icon-transform-origin instead of hardcoding "50% 50%" here */ - graphene_matrix_init_translate (&m1, &(graphene_point3d_t)GRAPHENE_POINT3D_INIT(width / 2.0, height / 2.0, 0)); + graphene_matrix_init_translate (&m1, &GRAPHENE_POINT3D_INIT(width / 2.0, height / 2.0, 0)); graphene_matrix_multiply (&transform_matrix, &m1, &m3); - graphene_matrix_init_translate (&m2, &(graphene_point3d_t)GRAPHENE_POINT3D_INIT(- width / 2.0, - height / 2.0, 0)); + graphene_matrix_init_translate (&m2, &GRAPHENE_POINT3D_INIT(- width / 2.0, - height / 2.0, 0)); graphene_matrix_multiply (&m2, &m3, &m1); gtk_snapshot_transform (snapshot, &m1); @@ -230,7 +230,7 @@ gtk_css_style_render_icon_get_extents (GtkCssStyle *style, if (!gtk_css_transform_value_get_matrix (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_TRANSFORM), &transform_matrix)) return; - graphene_matrix_init_translate (&translate_matrix, &(graphene_point3d_t)GRAPHENE_POINT3D_INIT(x + width / 2.0, y + height / 2.0, 0)); + graphene_matrix_init_translate (&translate_matrix, &GRAPHENE_POINT3D_INIT(x + width / 2.0, y + height / 2.0, 0)); graphene_matrix_multiply (&transform_matrix, &translate_matrix, &matrix); graphene_rect_init (&bounds, - width / 2.0, - height / 2.0, @@ -273,9 +273,9 @@ gtk_css_style_snapshot_icon_texture (GtkCssStyle *style, graphene_matrix_init_from_matrix (&saved_matrix, gtk_snapshot_get_transform (snapshot)); /* XXX: Implement -gtk-icon-transform-origin instead of hardcoding "50% 50%" here */ - graphene_matrix_init_translate (&m1, &(graphene_point3d_t)GRAPHENE_POINT3D_INIT(width / 2.0, height / 2.0, 0)); + graphene_matrix_init_translate (&m1, &GRAPHENE_POINT3D_INIT(width / 2.0, height / 2.0, 0)); graphene_matrix_multiply (&transform_matrix, &m1, &m3); - graphene_matrix_init_translate (&m2, &(graphene_point3d_t)GRAPHENE_POINT3D_INIT(- width / 2.0, - height / 2.0, 0)); + graphene_matrix_init_translate (&m2, &GRAPHENE_POINT3D_INIT(- width / 2.0, - height / 2.0, 0)); graphene_matrix_multiply (&m2, &m3, &m1); gtk_snapshot_transform (snapshot, &m1); diff --git a/gtk/inspector/rendernodeview.c b/gtk/inspector/rendernodeview.c index 7757fb511c..c9202043bd 100644 --- a/gtk/inspector/rendernodeview.c +++ b/gtk/inspector/rendernodeview.c @@ -239,9 +239,8 @@ gtk_render_node_view_snapshot (GtkWidget *widget, cairo_translate (cr, - viewport.x - viewport.width / 2.0, - viewport.y - viewport.height / 2.0); fallback = gsk_renderer_create_fallback (gtk_snapshot_get_renderer (snapshot), - &(graphene_rect_t) - GRAPHENE_RECT_INIT (viewport.x, viewport.y, - viewport.width, viewport.height), + &GRAPHENE_RECT_INIT (viewport.x, viewport.y, + viewport.width, viewport.height), cr); gsk_renderer_render (fallback, priv->render_node, NULL); g_object_unref (fallback); -- 2.30.2